﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using vngoodlife.Models;

namespace vngoodlife.Singleton
{
    public class DataSingleton
    {
        private DataSingleton() { }

        private static DataSingleton _instance;

        private static DataLinQDataContext _linQContext;
        private static MemberModels _memberModel;
        private static AlbumModels _albumModels;
        private static ArticleModels _articleModels;

        private static ArticleStatusModels _articleStatusModels;
        private static ArticleSubjectModels _articleSubjectModels;
        private static BannerLocationModels _bannerLocationModels;
        private static GeneralModels _generalModels;

        private static BannerModels _bannerModels;
        private static CommentModels _commentModels;
        private static ConversationModels _conversationModels;
        private static ExchangeGiftModels _exchangeGiftModels;
        private static FollowModels _followModels;

        private static GiftStatusModels _giftStatusModels;
        private static ImageModels _imageModels;
        private static ImportGiftModels _importGiftModels;
        private static LikeModels _likeModels;
        private static MarkHistoryModels _markHistoryModels;

        private static MarkModels _markModels;
        private static MenuListModels _menuListModels;
        private static MenuTypeModels _menuTypeModels;
        private static MessageModels _messageModels;
        private static NoticeModels _noticeModels;

        private static RoleModels _roleModels;
        private static TagsModels _tagsModels;
        private static WallModels _wallModels;
        private static TypesOfArticleModels _typesOfArticleModels;
        private static ArticleTagModels _articleTagModels;

        private static RelatedArticleModels _relatedArticleModels;
        private static GenderModels _genderModels;


        //private static List<Gender> _genderList;
        public static List<int> _listNewArticleIDsOfEachArticleType = new List<int> { };
        

        public static DataSingleton Instance
        {
            get 
            {
                if (_instance == null)
                {
                    _instance = new DataSingleton();
                }
                return _instance;
            }
        }

        public DataSingleton RefreshInstance()
        {
            _instance = new DataSingleton();
            return _instance;
        }

        public DataLinQDataContext RefreshLinQContext()
        {
            _linQContext = new DataLinQDataContext();
            return _linQContext;
        }

        public DataLinQDataContext GetLinQContext()
        {
            if (_linQContext == null)
            {
                _linQContext = new DataLinQDataContext();
            }
            return _linQContext;
        }

        public MemberModels GetMemberModel()
        {
            if (_memberModel == null)
            {
                _memberModel = new MemberModels();
            }
            return _memberModel;
        }

        public ArticleModels GetArticleModels()
        {
            if (_articleModels == null)
            {
                _articleModels = new ArticleModels();
            }
            return _articleModels;
        }

        public AlbumModels GetAlbumModels()
        {
            if (_albumModels == null)
            {
                _albumModels = new AlbumModels();
            }
            return _albumModels;
        }

        public ArticleStatusModels GetArticleStatusModels()
        {
            if (_articleStatusModels == null)
            {
                _articleStatusModels = new ArticleStatusModels();
            }
            return _articleStatusModels;
        }

        public ArticleSubjectModels GetArticleSubjectModels()
        {
            if (_articleSubjectModels == null)
            {
                _articleSubjectModels = new ArticleSubjectModels();
            }
            return _articleSubjectModels;
        }

        public BannerLocationModels GetBannerLocationModels()
        {
            if (_bannerLocationModels == null)
            {
                _bannerLocationModels = new BannerLocationModels();
            }
            return _bannerLocationModels;
        }

        public BannerModels GetBannerModels()
        {
            if (_bannerModels == null)
            {
                _bannerModels = new BannerModels();
            }
            return _bannerModels;
        }

        public CommentModels GetCommentModels()
        {
            if (_commentModels == null)
            {
                _commentModels = new CommentModels();
            }
            return _commentModels;
        }

        public ConversationModels GetConversationModels()
        {
            if (_conversationModels == null)
            {
                _conversationModels = new ConversationModels();
            }
            return _conversationModels;
        }

        public ExchangeGiftModels GetExchangeGiftModels()
        {
            if (_exchangeGiftModels == null)
            {
                _exchangeGiftModels = new ExchangeGiftModels();
            }
            return _exchangeGiftModels;
        }

        public FollowModels GetFollowModels()
        {
            if (_followModels == null)
            {
                _followModels = new FollowModels();
            }
            return _followModels;
        }

        public GiftStatusModels GetGiftStatusModels()
        {
            if (_giftStatusModels == null)
            {
                _giftStatusModels = new GiftStatusModels();
            }
            return _giftStatusModels;
        }

        public ImageModels GetImageModels()
        {
            if (_imageModels == null)
            {
                _imageModels = new ImageModels();
            }
            return _imageModels;
        }

        public ImportGiftModels GetImportGiftModels()
        {
            if (_importGiftModels == null)
            {
                _importGiftModels = new ImportGiftModels();
            }
            return _importGiftModels;
        }

        public LikeModels GetLikeModels()
        {
            if (_likeModels == null)
            {
                _likeModels = new LikeModels();
            }
            return _likeModels;
        }

        public MarkHistoryModels GetMarkHistoryModels()
        {
            if (_markHistoryModels == null)
            {
                _markHistoryModels = new MarkHistoryModels();
            }
            return _markHistoryModels;
        }

        public MarkModels GetMarkModels()
        {
            if (_markModels == null)
            {
                _markModels = new MarkModels();
            }
            return _markModels;
        }

        public MenuListModels GetMenuListModels()
        {
            if (_menuListModels == null)
            {
                _menuListModels = new MenuListModels();
            }
            return _menuListModels;
        }

        public MenuTypeModels GetMenuTypeModels()
        {
            if (_menuTypeModels == null)
            {
                _menuTypeModels = new MenuTypeModels();
            }
            return _menuTypeModels;
        }

        public MessageModels GetMessageModels()
        {
            if (_messageModels == null)
            {
                _messageModels = new MessageModels();
            }
            return _messageModels;
        }

        public NoticeModels GetNoticeModels()
        {
            if (_noticeModels == null)
            {
                _noticeModels = new NoticeModels();
            }
            return _noticeModels;
        }

        public RoleModels GetRoleModels()
        {
            if (_roleModels == null)
            {
                _roleModels = new RoleModels();
            }
            return _roleModels;
        }

        public TagsModels GetTagsModels()
        {
            if (_tagsModels == null)
            {
                _tagsModels = new TagsModels();
            }
            return _tagsModels;
        }

        public WallModels GetWallModels()
        {
            if (_wallModels == null)
            {
                _wallModels = new WallModels();
            }
            return _wallModels;
        }

        public GeneralModels GetGeneralModels()
        {
            if (_generalModels == null)
            {
                _generalModels = new GeneralModels();
            }
            return _generalModels;
        }
        
        public TypesOfArticleModels GetTypesOfArticleModels()
        {
            if (_typesOfArticleModels == null)
            {
                _typesOfArticleModels = new TypesOfArticleModels();
            }
            return _typesOfArticleModels;
        }

        public ArticleTagModels GetArticleTagModels()
        {
            if (_articleTagModels == null)
            {
                _articleTagModels = new ArticleTagModels();
            }
            return _articleTagModels;
        }


        public RelatedArticleModels GetRelatedArticleModels()
        {
            if (_relatedArticleModels == null)
            {
                _relatedArticleModels = new RelatedArticleModels();
            }
            return _relatedArticleModels;
        }

        public GenderModels GetGenderModels()
        {
            if (_genderModels == null)
            {
                _genderModels = new GenderModels();
            }
            return _genderModels;
        }

        //public List<Gender> GetGenderList()
        //{
        //    if (_genderList == null)
        //    {
        //        _genderList = new List<Gender>() 
        //        {
        //            new Gender{Sex=0, Name="Không xác định"},
        //            new Gender{Sex=1, Name="Nam"},
        //            new Gender{Sex=2, Name="Nữ"},
        //        };
        //    }
        //    return _genderList;
        //}
    }
}